package com.suixun.enums;

public enum ApiCode {
	HTTP_200(200, "成功"), HTTP_500(500, "失败"), HTTP__500(-500, "服务器发生错误,请稍后再操作"),HTTP_401(401, "登录已过期，为保护您的账号安全，请重新登录!");

	private int code;

	private String msg;

	private ApiCode(int _code, String _msg) {
		this.code = _code;
		this.msg = _msg;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public static String getNameById(int code) {
		for (ApiCode g : ApiCode.values()) {
			if (g.getCode() == code) {
				return g.getMsg();
			}
		}
		return "";
	}

	public ApiCode setCustomMsg(String msg) {
		this.msg = msg;
		return this;
	}
}
